﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace Batman.Jianbei.Forum.Migrations.ChatRoomDb
{
    public partial class _201907181 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "RoomMask",
                columns: table => new
                {
                    Id = table.Column<string>(nullable: false),
                    RoomId = table.Column<string>(nullable: true),
                    MaskId = table.Column<string>(nullable: true),
                    Uid = table.Column<string>(nullable: true),
                    IsInRoom = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoomMask", x => x.Id);
                    table.ForeignKey(
                        name: "FK_RoomMask_Mask_MaskId",
                        column: x => x.MaskId,
                        principalTable: "Mask",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_RoomMask_TalkRoom_RoomId",
                        column: x => x.RoomId,
                        principalTable: "TalkRoom",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_RoomMask_MaskId",
                table: "RoomMask",
                column: "MaskId");

            migrationBuilder.CreateIndex(
                name: "IX_RoomMask_RoomId",
                table: "RoomMask",
                column: "RoomId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "RoomMask");
        }
    }
}
